package com.darren.center.shardingjdbc.demo.dto;

import lombok.Data;

import java.io.Serializable;

/**
 * Author: 01403292
 * Date: 2021-08-05 15:40:03
 * Version: 1.0
 * Description:
 * 分页查询基类参数封装类
 * 设置默认值的目的防止未设置参数而导致系统异常
 */
@Data
public class RequestBaseDTO implements Serializable {

    /**
     * 当前检索页码
     */
    private Integer currentPage;

    /**
     * 分页大小设置
     */
    private Integer pageSize;

    public Integer getCurrentPage() {
        if(this.currentPage == null){
            this.currentPage = 0;
        }
        return this.currentPage;
    }

    public void setCurrentPage(Integer currentPage) {
        this.currentPage = currentPage;
    }

    public Integer getPageSize() {
        if(this.pageSize == null){
            this.pageSize = 10;
        }
        return this.pageSize;
    }

    public void setPageSize(Integer pageSize) {
        this.pageSize = pageSize;
    }

}
